﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PGMHelper;
using WH = PGMHelper.WilsonHelper;

namespace CouplingBeamStiff
{
    /// <summary>
    /// 全局变量类
    /// </summary>
    public static class GlobalVar
    {
        /// <summary>
        /// 剖分尺度
        /// </summary>
        public static double MeshDimension = 100;

        /// <summary>
        /// 混凝土弹性模量
        /// </summary>
        public static double ConcreteYoungsModulus = 6E4;
        /// <summary>
        /// 混凝土泊松比
        /// </summary>
        public static double ConcretePossionRatio = 0.2;
        /// <summary>
        /// 厚度
        /// </summary>
        public static double Thickness = 200;

        /// <summary>
        /// 顶点水平力
        /// </summary>
        public static double MaxLoad = 10000;

        /// <summary>
        /// 计算等效梁高的相对误差
        /// </summary>
        public static double GetEquilibrumBeamHeigthTol = 1E-2;
        /// <summary>
        /// 初始化模型函数
        /// </summary>
        public static void Initial()
        {
            var group = "Global";
            var fileName = WH.GetAssemblyDirectory() + "\\CouplingBeamProj.ini";
            MeshDimension = Convert.ToDouble(WH.ReadINI(group, "MeshDimension", "100", fileName));
            ConcreteYoungsModulus = Convert.ToDouble(WH.ReadINI(group, "ConcreteYoungsModulus", "3E4", fileName));
            ConcretePossionRatio = Convert.ToDouble(WH.ReadINI(group, "ConcretePossionRatio", "0.2", fileName));
            Thickness = Convert.ToDouble(WH.ReadINI(group, "Thickness", "200", fileName));
            GetEquilibrumBeamHeigthTol = Convert.ToDouble(WH.ReadINI(group, "GetEquilibrumBeamHeigthTol", "0.01", fileName));
            MaxLoad = Convert.ToDouble(WH.ReadINI(group, "MaxLoad", "10000", fileName));
        }
    }
}
